package com.javabaas.server.novel_server.common;

import java.util.HashMap;
import java.util.Map;

public class ResponseJson {

    public static Map<String, Object> getResponseJson(ModuleCode moduleCode, int code, String msg) {
        Map<String, Object> json = new HashMap<>();
        json.put(Constant.KEY_RES_STATUS_CODE, moduleCode.getCode()+code);
        json.put(Constant.KEY_RES_MSG, msg);
        return json;
    }

    public static Map<String, Object> getResponseJson(ModuleCode moduleCode, StatusCode statusCode) {
        Map<String, Object> json = new HashMap<>();
        json.put(Constant.KEY_RES_STATUS_CODE, moduleCode.getCode()+statusCode.getCode());
        json.put(Constant.KEY_RES_MSG, statusCode.getMsg());
        return json;
    }

    public static Map<String, Object> getResponseJson(ModuleCode moduleCode, StatusCode statusCode, Object o) {
        Map<String, Object> json = new HashMap<>();
        json.put(Constant.KEY_RES_STATUS_CODE, moduleCode.getCode()+statusCode.getCode());
        json.put(Constant.KEY_RES_MSG, statusCode.getMsg());
        json.put("result", o);
        return json;
    }

    public static Map<String, Object> getResponseJson(ModuleCode moduleCode, StatusCode statusCode, Map<String, Object> map) {
        Map<String, Object> json = new HashMap<>();
        json.put(Constant.KEY_RES_STATUS_CODE, moduleCode.getCode()+statusCode.getCode());
        json.put(Constant.KEY_RES_MSG, statusCode.getMsg());
        json.putAll(map);
        return json;
    }

}
